package com.ssm.admin.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ssm.common.utils.PageUtils;
import com.ssm.common.utils.Query;

import com.ssm.admin.dao.SsmGoodsDao;
import com.ssm.admin.entity.SsmGoodsEntity;
import com.ssm.admin.service.SsmGoodsService;


@Service("ssmGoodsService")
public class SsmGoodsServiceImpl extends ServiceImpl<SsmGoodsDao, SsmGoodsEntity> implements SsmGoodsService {

    @Autowired
    private SsmGoodsDao ssmGoodsDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<SsmGoodsEntity> page = this.page(
                new Query<SsmGoodsEntity>().getPage(params),
                new QueryWrapper<SsmGoodsEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public ArrayList<SsmGoodsEntity> select(String key) {
        ArrayList<SsmGoodsEntity> goodsList = (ArrayList<SsmGoodsEntity>) ssmGoodsDao.selectList(new QueryWrapper<SsmGoodsEntity>().like("goodsName", key));
        return goodsList;
    }


}